package com.towncoder;

import com.towncoder.binding.MapperProxyFactory;
import com.towncoder.binding.UserMapper;

public class Main {
    public static void main(String[] args) {
        // 封装到工厂
//        UserMapper object = (UserMapper) Proxy.newProxyInstance(
//                Thread.currentThread().getContextClassLoader(),
//                new Class[]{UserMapper.class}, (proxy, method, arg) -> "你被代理了！");
        MapperProxyFactory<UserMapper> proxyFactory = new MapperProxyFactory<>(UserMapper.class);
        UserMapper userMapper = proxyFactory.newInstance();
        System.out.println(userMapper.getUser());
    }
}